import type Editor from '../../editor'
import type Operation from '../../operations/operation';
let isBoolean:boolean = false;
let apply:Function = () =>{};
export default function withLogger (editor:Editor,target:HTMLElement) {
    if(!isBoolean){
        apply = editor.apply.bind(editor)
        editor.apply = (operation: Operation) => {
            console.log('operation', operation)
            apply(operation)
        }
        target.innerHTML = '日志关闭'
    }else{
        editor.apply = apply.bind(editor)
        target.innerHTML = '日志打印'
    }
    isBoolean = !isBoolean
}